﻿CREATE TABLE [dbo].[order_product] (
    [ID]               INT             IDENTITY (1, 1) NOT NULL,
    [OrderNo]          VARCHAR (255)   NOT NULL,
    [NoteDate]         DATETIME        NOT NULL,
    [HouseID]          INT             NOT NULL,
    [OperatorUserID]   INT             NOT NULL,
    [CreatedOn]        DATETIME        NOT NULL,
    [TotalMoney]       DECIMAL (10, 2) NOT NULL,
    [Method]           INT             DEFAULT ('0') NOT NULL,
    [AssociatedDealID] INT             NULL,
    [Description]      NVARCHAR (500)  NULL,
    PRIMARY KEY CLUSTERED ([ID] ASC),
    CONSTRAINT [FK_order_product_order_deal] FOREIGN KEY ([AssociatedDealID]) REFERENCES [dbo].[order_deal] ([ID]),
    CONSTRAINT [FK_order_product_users] FOREIGN KEY ([OperatorUserID]) REFERENCES [dbo].[users] ([ID]),
    CONSTRAINT [FK_order_product_warehouses] FOREIGN KEY ([HouseID]) REFERENCES [dbo].[warehouses] ([ID])
);



